package com.espirit.builder.biz;

import org.springframework.stereotype.Component;

import com.espirit.eap.manager.ModelBuilderSupport;
import com.espirit.eap.manager.ProofNbrRule;
import com.espirit.eap.pagelayout.ModelField;
@Component
public class ProofNbrRuleBuilder extends ModelBuilderSupport {
	private static final String FIELD_NAME="name";
	
	private static final String FIELD_PREFIX="prefix";
	private static final String FIELD_PREFIX1="prefix1";
	private static final String FIELD_PREFIX2="prefix2";
	private static final String FIELD_PREFIX3="prefix3";
	private static final String FIELD_PREFIX4="prefix4";
	private static final String FIELD_PREFIX5="prefix5";
	private static final String FIELD_PREFIX6="prefix6";
	private static final String FIELD_PREFIX7="prefix7";
	private static final String FIELD_PREFIX8="prefix8";
	
	private static final String FIELD_DIGIT="digit";
	private static final String FIELD_NEXTNBR="nextNbr";
	
	@Override
	public boolean init() {
		return super.setClass(ProofNbrRule.class, "Nbr Rule", "凭证号规则") ;
	}
	
	@Override
	public void buildFields() {
		addModelField(FIELD_NAME, "Name", "名称");
		addModelField(FIELD_PREFIX1, "Prefix 1", "前缀1");
		addModelField(FIELD_PREFIX2, "Prefix 2", "前缀2");
		addModelField(FIELD_PREFIX3, "Prefix 3", "前缀3");
		addModelField(FIELD_PREFIX4, "Prefix 4", "前缀4");
		addModelField(FIELD_PREFIX5, "Prefix 5", "前缀5");
		addModelField(FIELD_PREFIX6, "Prefix 6", "前缀6");
		addModelField(FIELD_PREFIX7, "Prefix 7", "前缀7");
		addModelField(FIELD_PREFIX8, "Prefix 8", "前缀8");
		addModelField(FIELD_PREFIX, "Prefix code", "前缀编码");
		addModelField(FIELD_DIGIT, "Digit places ", "流水位数");
		addModelField(FIELD_NEXTNBR, "Next number ", "下一个号");
	}
	@Override
	public void prepareLayoutElements() {
		ModelField mfName = getModelField(FIELD_NAME);
		ModelField mfPrefix1 = getModelField(FIELD_PREFIX1);
		ModelField mfPrefix2 = getModelField(FIELD_PREFIX2);
		
		ModelField mfPrefix3 = getModelField(FIELD_PREFIX3);
		ModelField mfPrefix4 = getModelField(FIELD_PREFIX4);
		
		ModelField mfPrefix5 = getModelField(FIELD_PREFIX5);
		ModelField mfPrefix6 = getModelField(FIELD_PREFIX6);
		
		ModelField mfPrefix7 = getModelField(FIELD_PREFIX7);
		ModelField mfPrefix8 = getModelField(FIELD_PREFIX8);
		
		ModelField mfPrefix = getModelField(FIELD_PREFIX);
		ModelField mfDigit = getModelField(FIELD_DIGIT);
		ModelField mfNextNbr = getModelField(FIELD_NEXTNBR);
		
		addListField(mfName,mfPrefix);
		addDetailField(mfName,mfPrefix,mfPrefix1,mfPrefix2,mfPrefix3,mfPrefix4,mfPrefix5,mfPrefix6,mfPrefix7,mfPrefix8,mfDigit,mfNextNbr);
		super.prepareLayoutElements();
	}
	
	protected void afterBuilderLayout() {
		super.afterBuilderLayout();
	}
	
	@Override
	public void initDefaultData() {

		super.initDefaultData();
	}
	
}
